From the PO.DAAC Cookbook, to access the GitHub version of the notebook, follow this link.

SWOT Hydrology Dataset Exploration in the Cloud

Accessing and Visualizing SWOT Datasets

Requirement:

This tutorial can only be run in an AWS cloud instance running in us-west-2: NASA Earthdata Cloud data in S3 can be directly accessed via earthaccess python library; this access is limited to requests made within the US West (Oregon) (code: us-west-2) AWS region.

Learning Objectives:

  • Access SWOT HR data prodcuts (archived in NASA Earthdata Cloud) within the AWS cloud, without downloading to local machine
  • Visualize accessed data for a quick check

SWOT Level 2 KaRIn High Rate Version 2.0 Datasets:

  1. River Vector Shapefile - SWOT_L2_HR_RIVERSP_2.0

  2. Lake Vector Shapefile - SWOT_L2_HR_LAKESP_2.0

  3. Water Mask Pixel Cloud NetCDF - SWOT_L2_HR_PIXC_2.0

  4. Water Mask Pixel Cloud Vector Attribute NetCDF - SWOT_L2_HR_PIXCVec_2.0

  5. Raster NetCDF - SWOT_L2_HR_Raster_2.0

  6. Single Look Complex Data product - SWOT_L1B_HR_SLC_2.0

Notebook Author: Cassie Nickles, NASA PO.DAAC (Feb 2024) || Other Contributors: Zoe Walschots (PO.DAAC Summer Intern 2023), Catalina Taglialatela (NASA PO.DAAC), Luis Lopez (NASA NSIDC DAAC)

Last updated: 7 Feb 2024

Libraries Needed

import glob
import s3fs
import fiona
import netCDF4 as nc
import h5netcdf
import xarray as xr
import pandas as pd
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt
import hvplot.xarray
import earthaccess
from earthaccess import Auth, DataCollections, DataGranules, Store

Earthdata Login

An Earthdata Login account is required to access data, as well as discover restricted data, from the NASA Earthdata system. Thus, to access NASA data, you need Earthdata Login. If you don’t already have one, please visit https://urs.earthdata.nasa.gov to register and manage your Earthdata Login account. This account is free to create and only takes a moment to set up. We use earthaccess to authenticate your login credentials below.

auth = earthaccess.login()

Single File Access

1. River Vector Shapefiles

The s3 access link can be found using earthaccess data search. Since this collection consists of Reach and Node files, we need to extract only the granule for the Reach file. We do this by filtering for the ‘Reach’ title in the data link.

Alternatively, Earthdata Search (see tutorial) can be used to search in a map graphic user interface.

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

Search for the data of interest

#Retrieves granule from the day we want, in this case by passing to `earthdata.search_data` function the data collection shortname, temporal bounds, and filter by wildcards
river_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_RIVERSP_2.0', 
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        granule_name = '*Reach*_009_NA*') # here we filter by Reach files (not node), pass=009, continent code=NA
Granules found: 5

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=river_results)

Create Fiona session to work with zip and embedded shapefiles in the AWS Cloud

The native format for this data is a .zip file, and we want the .shp file within the .zip file, so we will create a Fiona AWS session using the credentials from setting up the s3fs session above to access the shapefiles within the zip files. If we don’t do this, the alternative would be to download the data to the cloud environment (e.g. EC2 instance, user S3 bucket) and extract the .zip file there.

fiona_session=fiona.session.AWSSession(
        aws_access_key_id=fs_s3.storage_options["key"],
        aws_secret_access_key=fs_s3.storage_options["secret"],
        aws_session_token=fs_s3.storage_options["token"]
    )
# Get the link for the first zip file
river_link = earthaccess.results.DataGranule.data_links(river_results[0], access='direct')[0]

# We use the zip+ prefix so fiona knows that we are operating on a zip file
river_shp_url = f"zip+{river_link}"

with fiona.Env(session=fiona_session):
    SWOT_HR_shp1 = gpd.read_file(river_shp_url) 

#view the attribute table
SWOT_HR_shp1 
reach_id time time_tai time_str p_lat p_lon river_name wse wse_u wse_r_u ... p_wid_var p_n_nodes p_dist_out p_length p_maf p_dam_id p_n_ch_max p_n_ch_mod p_low_slp geometry
0 71224500951 -1.000000e+12 -1.000000e+12 no_data 48.517717 -93.692086 Rainy River -1.000000e+12 -1.000000e+12 -1.000000e+12 ... 1480.031 53 244919.492 10586.381484 -1.000000e+12 0 1 1 0 LINESTRING (-93.76076 48.51651, -93.76035 48.5...
1 71224700013 7.540761e+08 7.540762e+08 2023-11-23T17:35:38Z 48.777900 -93.233350 no_data 3.364954e+02 9.003000e-02 2.290000e-03 ... 1239358.412 18 3719.676 3514.736672 -1.000000e+12 0 6 1 0 LINESTRING (-93.21387 48.78466, -93.21403 48.7...
2 71224700021 7.540761e+08 7.540762e+08 2023-11-23T17:35:38Z 48.772163 -93.266891 no_data 3.365123e+02 9.199000e-02 1.902000e-02 ... 76609.119 8 5305.752 1586.075688 -1.000000e+12 0 6 1 0 LINESTRING (-93.25587 48.77340, -93.25628 48.7...
3 71224700033 7.540761e+08 7.540762e+08 2023-11-23T17:35:38Z 48.733727 -93.116424 no_data 3.365715e+02 9.068000e-02 1.112000e-02 ... 297730.945 20 306795.237 3904.961218 -1.000000e+12 0 3 1 0 LINESTRING (-93.09779 48.73888, -93.09820 48.7...
4 71224700041 7.540761e+08 7.540762e+08 2023-11-23T17:35:38Z 48.720271 -93.113458 no_data 3.364742e+02 9.085000e-02 1.238000e-02 ... 0.000 6 302890.276 1203.102119 -1.000000e+12 0 1 1 0 LINESTRING (-93.12101 48.72305, -93.12060 48.7...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
926 77125000241 7.540756e+08 7.540756e+08 2023-11-23T17:26:38Z 17.960957 -100.025397 no_data 3.560650e+02 1.501928e+02 1.501928e+02 ... 864.151 70 464330.310 13953.442643 -1.000000e+12 0 2 1 0 LINESTRING (-100.06409 17.97308, -100.06403 17...
927 77125000254 -1.000000e+12 -1.000000e+12 no_data 17.949648 -99.995193 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 ... 21491.314 2 464735.375 405.065100 -1.000000e+12 10286 1 1 0 LINESTRING (-99.99547 17.95148, -99.99564 17.9...
928 77125000261 7.540756e+08 7.540756e+08 2023-11-23T17:26:47Z 18.362207 -100.696472 no_data 2.316304e+02 9.208000e-02 1.946000e-02 ... 3624.715 56 325106.825 11105.124379 -1.000000e+12 0 4 1 0 LINESTRING (-100.68734 18.40208, -100.68723 18...
929 77125000263 -1.000000e+12 -1.000000e+12 no_data 17.956269 -99.961388 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 ... 43956.311 49 474450.182 9714.807127 -1.000000e+12 0 2 1 0 LINESTRING (-99.99398 17.94824, -99.99369 17.9...
930 77125000273 -1.000000e+12 -1.000000e+12 no_data 17.952683 -99.906755 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 ... 283915.163 49 484179.822 9729.640027 -1.000000e+12 0 2 1 0 LINESTRING (-99.93256 17.94746, -99.93273 17.9...

931 rows × 127 columns

Quickly plot the SWOT river data

# Simple plot
fig, ax = plt.subplots(figsize=(7,5))
SWOT_HR_shp1.plot(ax=ax, color='black')

# # Another way to plot geopandas dataframes is with `explore`, which also plots a basemap
# SWOT_HR_shp1.explore()

2. Lake Vector Shapefiles

The lake vector shapefiles can be accessed in the same way as the river shapefiles above.

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

Search for data of interest

lake_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_LAKESP_2.0', 
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        granule_name = '*Obs*_009_NA*') # here we filter by files with 'Obs' in the name (This collection has three options: Obs, Unassigned, and Prior), pass #8 and continent code=NA
Granules found: 2

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=lake_results)

Create Fiona session to work with zip and embedded shapefiles in the AWS Cloud

The native format for this data is a .zip file, and we want the .shp file within the .zip file, so we will create a Fiona AWS session using the credentials from setting up the s3fs session above to access the shapefiles within the zip files. If we don’t do this, the alternative would be to download the data to the cloud environment (e.g. EC2 instance, user S3 bucket) and extract the .zip file there.

fiona_session=fiona.session.AWSSession(
        aws_access_key_id=fs_s3.storage_options["key"],
        aws_secret_access_key=fs_s3.storage_options["secret"],
        aws_session_token=fs_s3.storage_options["token"]
    )
# Get the link for the first zip file
lake_link = earthaccess.results.DataGranule.data_links(lake_results[0], access='direct')[0]

# We use the zip+ prefix so fiona knows that we are operating on a zip file
lake_shp_url = f"zip+{lake_link}"

with fiona.Env(session=fiona_session):
    SWOT_HR_shp2 = gpd.read_file(lake_shp_url) 

#view the attribute table
SWOT_HR_shp2
obs_id lake_id overlap n_overlap reach_id time time_tai time_str wse wse_u ... load_tidef load_tideg pole_tide dry_trop_c wet_trop_c iono_c xovr_cal_c lake_name p_res_id geometry
0 771190L999978 7710050732;7710050703;7710050672;7710050662;77... 9;86;79;70;65 5 no_data 7.558783e+08 7.558783e+08 2023-12-14T14:12:29Z 1888.880 0.002 ... -0.016630 -0.018661 0.004459 -1.865485 -0.153819 -0.005181 -1.116717 PRESA SOLS -99999999 MULTIPOLYGON (((-100.49406 20.07574, -100.4938...
1 752199L999957 7520013722;7520013783 66;17 2 no_data 7.558784e+08 7.558784e+08 2023-12-14T14:14:08Z 156.216 0.034 ... -0.014181 -0.015942 0.005326 -2.293956 -0.252575 -0.004943 -0.351363 no_data -99999999 MULTIPOLYGON (((-99.37239 25.63900, -99.37194 ...
2 752200L999987 7520013712 59 1 no_data 7.558784e+08 7.558784e+08 2023-12-14T14:14:09Z 171.336 0.095 ... -0.014314 -0.016066 0.005341 -2.289045 -0.249914 -0.004935 -0.555793 no_data -99999999 MULTIPOLYGON (((-99.39476 25.73965, -99.39442 ...
3 752200L999975 7520010832 75 1 no_data 7.558784e+08 7.558784e+08 2023-12-14T14:14:09Z 173.704 0.092 ... -0.014527 -0.016270 0.005346 -2.288555 -0.249523 -0.004927 -0.880471 no_data -99999999 MULTIPOLYGON (((-99.49457 25.75364, -99.49435 ...
4 752201L999995 7520010502 97 1 no_data 7.558785e+08 7.558785e+08 2023-12-14T14:14:20Z 86.140 0.183 ... -0.014221 -0.015947 0.005429 -2.310065 -0.251561 -0.004908 -0.461625 no_data -99999999 MULTIPOLYGON (((-99.18978 26.22343, -99.18885 ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
24067 713255R000242 7131518382 98 1 no_data 7.558790e+08 7.558790e+08 2023-12-14T14:23:21Z 8.600 0.058 ... -0.003146 -0.002480 0.008959 -2.268371 -0.101818 -0.002132 0.371395 no_data -99999999 POLYGON ((-88.09984 56.45882, -88.09993 56.458...
24068 713255R000243 7131518562 88 1 no_data 7.558790e+08 7.558790e+08 2023-12-14T14:23:21Z 7.569 0.046 ... -0.002484 -0.002016 0.011788 -2.268953 -0.101874 -0.002134 0.536599 no_data -99999999 POLYGON ((-88.02194 56.44447, -88.02154 56.444...
24069 713255R000252 7131519822 96 1 no_data 7.558790e+08 7.558790e+08 2023-12-14T14:23:21Z 7.010 0.056 ... -0.002542 -0.002187 0.010853 -2.268864 -0.101836 -0.002132 0.410241 no_data -99999999 POLYGON ((-88.07451 56.46812, -88.07396 56.467...
24070 713255R000253 7131519842 92 1 no_data 7.558790e+08 7.558790e+08 2023-12-14T14:23:21Z 4.540 0.118 ... -0.001758 -0.001693 0.012287 -2.269519 -0.101934 -0.002135 0.580966 no_data -99999999 POLYGON ((-87.98967 56.45438, -87.98932 56.454...
24071 713255R000256 7131524362 61 1 no_data 7.558790e+08 7.558790e+08 2023-12-14T14:23:21Z 5.420 0.108 ... -0.001757 -0.001759 0.012288 -2.269569 -0.101906 -0.002133 0.503179 no_data -99999999 POLYGON ((-88.02147 56.47136, -88.02104 56.471...

24072 rows × 36 columns

Quickly plot the SWOT lakes data

fig, ax = plt.subplots(figsize=(7,5))
SWOT_HR_shp2.plot(ax=ax, color='black')

Accessing the remaining files is different than the shp files above. We do not need to read the shapefiles within a zip file using something like Fiona session (or to download and unzip in the cloud) because the following SWOT HR collections are stored in netCDF files in the cloud. For the rest of the products, we will open via xarray, not geopandas.

3. Water Mask Pixel Cloud NetCDF

Search for data collection and time of interest

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

pixc_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXC_2.0', 
                                        #granule_name = '*_009_*', # pass number 9 if we want to filter further
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        bounding_box = (-106.62, 38.809, -106.54, 38.859)) # Lake Travis near Austin, TX
Granules found: 18

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=pixc_results)

# get link for first file
pixc_link = earthaccess.results.DataGranule.data_links(pixc_results[0], access='direct')[0]

s3_file_obj3 = fs_s3.open(pixc_link, mode='rb')

Open data using xarray

The pixel cloud netCDF files are formatted with three groups titled, “pixel cloud”, “tvp”, or “noise” (more detail here). In order to access the coordinates and variables within the file, a group must be specified when calling xarray open_dataset.

ds_PIXC = xr.open_dataset(s3_file_obj3, group = 'pixel_cloud', engine='h5netcdf')
ds_PIXC
<xarray.Dataset>
Dimensions:                                (points: 2831150, complex_depth: 2,
                                            num_pixc_lines: 3279)
Coordinates:
    latitude                               (points) float64 ...
    longitude                              (points) float64 ...
Dimensions without coordinates: points, complex_depth, num_pixc_lines
Data variables: (12/61)
    azimuth_index                          (points) float64 ...
    range_index                            (points) float64 ...
    interferogram                          (points, complex_depth) float32 ...
    power_plus_y                           (points) float32 ...
    power_minus_y                          (points) float32 ...
    coherent_power                         (points) float32 ...
    ...                                     ...
    pixc_line_qual                         (num_pixc_lines) float64 ...
    pixc_line_to_tvp                       (num_pixc_lines) float32 ...
    data_window_first_valid                (num_pixc_lines) float64 ...
    data_window_last_valid                 (num_pixc_lines) float64 ...
    data_window_first_cross_track          (num_pixc_lines) float32 ...
    data_window_last_cross_track           (num_pixc_lines) float32 ...
Attributes:
    description:                 cloud of geolocated interferogram pixels
    interferogram_size_azimuth:  3279
    interferogram_size_range:    5750
    looks_to_efflooks:           1.5509548020673398
    num_azimuth_looks:           7.0
    azimuth_offset:              3

Simple plot of the results

# This could take a few minutes to plot
plt.scatter(x=ds_PIXC.longitude, y=ds_PIXC.latitude, c=ds_PIXC.height)
plt.colorbar().set_label('Height (m)')

4. Water Mask Pixel Cloud Vector Attribute NetCDF

Search for data of interest

pixcvec_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXCVEC_2.0', 
                                        #granule_name = '*_009_*', # pass number 9 if we want to filter further
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        bounding_box = (-106.62, 38.809, -106.54, 38.859)) # Lake Travis near Austin, TX 
Granules found: 19

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=pixcvec_results)

# get link for file 0
pixcvec_link = earthaccess.results.DataGranule.data_links(pixcvec_results[0], access='direct')[0]

s3_file_obj4 = fs_s3.open(pixcvec_link, mode='rb')

Open data using xarray

ds_PIXCVEC = xr.open_dataset(s3_file_obj4, decode_cf=False,  engine='h5netcdf')
ds_PIXCVEC
<xarray.Dataset>
Dimensions:               (points: 2831150, nchar_reach_id: 11,
                           nchar_node_id: 14, nchar_lake_id: 10,
                           nchar_obs_id: 13)
Dimensions without coordinates: points, nchar_reach_id, nchar_node_id,
                                nchar_lake_id, nchar_obs_id
Data variables:
    azimuth_index         (points) int32 ...
    range_index           (points) int32 ...
    latitude_vectorproc   (points) float64 ...
    longitude_vectorproc  (points) float64 ...
    height_vectorproc     (points) float32 ...
    reach_id              (points, nchar_reach_id) |S1 ...
    node_id               (points, nchar_node_id) |S1 ...
    lake_id               (points, nchar_lake_id) |S1 ...
    obs_id                (points, nchar_obs_id) |S1 ...
    ice_clim_f            (points) int8 ...
    ice_dyn_f             (points) int8 ...
Attributes: (12/45)
    Conventions:                     CF-1.7
    title:                           Level 2 KaRIn high rate pixel cloud vect...
    short_name:                      L2_HR_PIXCVec
    institution:                     CNES
    source:                          Level 1B KaRIn High Rate Single Look Com...
    history:                         2023-12-03T05:59:43.712142Z: Creation
    ...                              ...
    xref_prior_river_db_file:        
    xref_prior_lake_db_file:         SWOT_LakeDatabase_Nom_106_20000101T00000...
    xref_reforbittrack_files:        SWOT_RefOrbitTrackTileBoundary_Nom_20000...
    xref_param_l2_hr_laketile_file:  SWOT_Param_L2_HR_LakeTile_20000101T00000...
    ellipsoid_semi_major_axis:       6378137.0
    ellipsoid_flattening:            0.0033528106647474805

Simple plot

pixcvec_htvals = ds_PIXCVEC.height_vectorproc.compute()
pixcvec_latvals = ds_PIXCVEC.latitude_vectorproc.compute()
pixcvec_lonvals = ds_PIXCVEC.longitude_vectorproc.compute()

#Before plotting, we set all fill values to nan so that the graph shows up better spatially
pixcvec_htvals[pixcvec_htvals > 15000] = np.nan
pixcvec_latvals[pixcvec_latvals < 1] = np.nan
pixcvec_lonvals[pixcvec_lonvals > -1] = np.nan
plt.scatter(x=pixcvec_lonvals, y=pixcvec_latvals, c=pixcvec_htvals)
plt.colorbar().set_label('Height (m)')

5. Raster NetCDF

Search for data of interest

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

raster_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_Raster_2.0', 
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        granule_name = '*100m*', # here we filter by files with '100m' in the name (This collection has two resolution options: 100m & 250m)
                                        bounding_box = (-106.62, 38.809, -106.54, 38.859)) # Lake Travis near Austin, TX
Granules found: 34

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=raster_results)

# get link for file 
raster_link = earthaccess.results.DataGranule.data_links(raster_results[0], access='direct')[0]

s3_file_obj5 = fs_s3.open(raster_link, mode='rb')

Open data with xarray

ds_raster = xr.open_dataset(s3_file_obj5, engine='h5netcdf')
ds_raster
<xarray.Dataset>
Dimensions:                  (x: 1520, y: 1519)
Coordinates:
  * x                        (x) float64 2.969e+05 2.97e+05 ... 4.488e+05
  * y                        (y) float64 4.274e+06 4.274e+06 ... 4.426e+06
Data variables: (12/39)
    crs                      object ...
    longitude                (y, x) float64 ...
    latitude                 (y, x) float64 ...
    wse                      (y, x) float32 ...
    wse_qual                 (y, x) float32 ...
    wse_qual_bitwise         (y, x) float64 ...
    ...                       ...
    load_tide_fes            (y, x) float32 ...
    load_tide_got            (y, x) float32 ...
    pole_tide                (y, x) float32 ...
    model_dry_tropo_cor      (y, x) float32 ...
    model_wet_tropo_cor      (y, x) float32 ...
    iono_cor_gim_ka          (y, x) float32 ...
Attributes: (12/49)
    Conventions:                   CF-1.7
    title:                         Level 2 KaRIn High Rate Raster Data Product
    source:                        Ka-band radar interferometer
    history:                       2023-12-03T08:26:57Z : Creation
    platform:                      SWOT
    references:                    V1.1.1
    ...                            ...
    x_min:                         296900.0
    x_max:                         448800.0
    y_min:                         4274000.0
    y_max:                         4425800.0
    institution:                   CNES
    product_version:               04

Quick interactive plot with hvplot

ds_raster.wse.hvplot.image(y='y', x='x')

6. SLC

Search for data collection and time of interest

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

slc_results = earthaccess.search_data(short_name = 'SWOT_L1B_HR_SLC_2.0', 
                                        #temporal = ('2024-02-01 00:00:00', '2024-02-29 23:59:59'), # can also specify by time
                                        #granule_name = '*_009_*', # here we can additionally filter by pass number 009
                                        bounding_box = (-106.62, 38.809, -106.54, 38.859)) # Lake Travis near Austin, TX
Granules found: 36

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

fs_s3 = earthaccess.get_s3fs_session(results=slc_results)

# get link for file 
slc_link = earthaccess.results.DataGranule.data_links(slc_results[0], access='direct')[0]

s3_file_obj6 = fs_s3.open(slc_link, mode='rb')

Open data using xarray

The L1B_HR_SLC product file contains five NetCDF data group called the slc, xfactor, noise, tvp, and grdem groups. More info can be found in the product description document within the dataset table for each group.

ds_SLC = xr.open_dataset(s3_file_obj6, group = 'slc', engine='h5netcdf')
ds_SLC
<xarray.Dataset>
Dimensions:      (num_lines: 22956, num_pixels: 5623, complex_depth: 2)
Dimensions without coordinates: num_lines, num_pixels, complex_depth
Data variables:
    slc_plus_y   (num_lines, num_pixels, complex_depth) float32 ...
    slc_minus_y  (num_lines, num_pixels, complex_depth) float32 ...
    slc_qual     (num_lines) float32 ...
Attributes:
    description:  Single look complex images for plus_y and minus_y channels